package zju.ccnt.rest.domain;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Transient;
import java.util.List;

/**
 * Created by zha on 14/11/11.
 */
@Entity
public class Resource {
    @Id
    private String hashValue;
    private String extension;
    private String address;
    private int size;
    private boolean hasUploaded;

    @OneToMany(mappedBy = "resource")
    private List<BusinessResource> businessResources;

    public Resource(){}

    public String getHashValue() {
        return hashValue;
    }

    public void setHashValue(String hashValue) {
        this.hashValue = hashValue;
    }

    public String getExtension() {
        return extension;
    }

    public void setExtension(String extension) {
        this.extension = extension;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public boolean isHasUploaded() {
        return hasUploaded;
    }

    public void setHasUploaded(boolean hasUploaded) {
        this.hasUploaded = hasUploaded;
    }

//    //todo 到文件服务器下载的URL
//    public String getDownloadUrl(){
//       return this.address + "/" + this.hashValue;
//    }

}
